載入中 |
if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); include '../CSP.php'; header("X-Frame-Options: DENY"); header('X-XSS-Protection:1; mode=block'); header('Strict-Transport-Security: max-age=31536000;'); header_remove('X-Powered-By'); $this_page = "/life-d/view.php"; $home_str = "/home".$this_page; if(substr($_SERVER['REQUEST_URI'],0,strlen($this_page)) == $this_page || substr($_SERVER['REQUEST_URI'],0,strlen($home_str)) == $home_str){ header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404); include "../404.php"; } ini_set('session.cookie_httponly', 1); ini_set('session.cookie_secure', 1); ini_set('session.cookie_domain', 'yangfamily.tw'); ini_set('session.cookie_samesite', 'Strict'); ini_set('session.gc_maxlifetime', 60*60*24*3650); ini_set('session.gc_probability', 1); ini_set('session.gc_divisor', 1); session_save_path('../sessions'); session_start(); include '../csrf/csrf.class.php'; $csrf = new csrf(); // Generate Token Id and Valid $token_id = $csrf->get_token_id(); $token_value = $csrf->get_token($token_id); // Generate Random Form Names $form_names = $csrf->form_names(array('contact_name', 'contact_email','contact_tel','contact_gender','contact_content'), false); include "../../mysql_db_connection.php"; include "../chat_online_update_parameter.php"; include "../site_url.php"; $link = new mysqli($MYSQL_SERVER_SITE,$MYSQL_DB_USER,$MYSQL_DB_PASS,$MYSQL_DB_NAME); $link->set_charset('utf8mb4'); $link->query('SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci'); $str = "select introduction from yangfamily_yang where pattern='slideshow'"; $list = $link->query($str); list($introduction0) = $list->fetch_row(); $list->close(); $Uname = array(); $name = array(); $str = "select id,title from yangfamily_yang where pattern='members_yang' order by id asc"; $list = $link->query($str); while(list($id,$title) = $list->fetch_row()){ $Uname[$id] = $title; $name[$id] = htmlspecialchars($title); } $list->close(); if(isset($_POST['id']) && ctype_digit($_POST['id']) && $_POST['id'] > 0){ $id = intval($_POST['id']); $page_data = "id=".$id; }elseif(isset($_GET['id']) && ctype_digit($_GET['id']) && $_GET['id'] > 0){ $id = intval($_GET['id']); $page_data = "id=".$id; }else{ $page_data = ""; $id = 0; } $str = "select time,title,content,introduction,location,thumbnail,author,attachments,keywords from yangfamily_articles where id='$id' and hidden='F' and category='life' and (pattern='add' or pattern='right-info')"; $list = $link->query($str); if($list->num_rows <= 0){ header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404); include "../404.php"; } $this_page_location_href = '["/life/view/'.$id.'"]'; list($time,$title,$content,$introduction,$default_pic,$thumbnail,$author,$attachments,$tags) = $list->fetch_row(); $list->close(); $dt = date("Y-m-d H:i:s",$time); $content = htmlspecialchars($content); $author_name = $Uname[$author]; $attachments = explode("|",$attachments); $tags = explode("|",$tags); $o0 = ""; $author_id = array(); $author_title = array(); $author_thumbnail = array(); $tt_id = array(); $tt_title = array(); $tt_thumbnail = array(); $str = "select yangfamily_articles.id,yangfamily_articles.title,yangfamily_articles.thumbnail from yangfamily_lifetag inner join yangfamily_articles on yangfamily_lifetag.id=yangfamily_articles.serial where yangfamily_articles.author=$author and yangfamily_articles.hidden='F' and yangfamily_lifetag.tag in ('".implode("','",array_map(function($tag){ global $link; return $link->real_escape_string($tag); },$tags))."') order by yangfamily_articles.serial desc"; $list = $link->query($str); while(list($tag_id,$tag_title,$tag_thumbnail) = $list->fetch_row()){ array_push($tt_id,$tag_id); $tt_title[$tag_id] = $tag_title; $tt_thumbnail[$tag_id] = $tag_thumbnail; } $list->close(); $i = 0; $abc = array_count_values($tt_id); arsort($abc); foreach($abc as $index => $value){ if($index != $id){ array_push($author_id,$index); array_push($author_title,$tt_title[$index]); array_push($author_thumbnail,$tt_thumbnail[$index]); $i++; if($i > 5) break; } } if($i < 6){ $str = "select id,title,thumbnail from yangfamily_articles where author=$author and hidden='F' and category='life' and (pattern='add' or pattern='right-info') order by RAND()"; $list = $link->query($str); while(list($tag_id,$tag_title,$tag_thumbnail) = $list->fetch_row()){ if($tag_id != $id && !in_array($tag_id,$author_id)){ array_push($author_id,$tag_id); array_push($author_title,$tag_title); array_push($author_thumbnail,$tag_thumbnail); $i++; if($i > 5) break; } } $list->close(); } /*$str = "select id,title,thumbnail from yangfamily_articles where author='$author' and hidden='F' and category='life' and (pattern='add' or pattern='right-info') order by RAND()"; //time desc, serial desc"; $list = $link->query($str); $i = 0; while(list($same_author_id,$same_author_title,$same_author_thumbnail) = $list->fetch_row()){ if($same_author_id != $id){ array_push($author_id,$same_author_id); array_push($author_title,$same_author_title); array_push($author_thumbnail,$same_author_thumbnail); $i++; if($i > 5) break; } }*/ $comments_thumbnails = array(); $str = "select thumbnail from yangfamily_comments where title='$id' and LENGTH(thumbnail)>0"; $list = $link->query($str); while(list($comments_thumbnail) = $list->fetch_row()){ array_push($comments_thumbnails,$comments_thumbnail); } $list->close(); //$all_images = array_merge($attachments,$author_thumbnail,$comments_thumbnails); $all_images = array_merge($author_thumbnail,$comments_thumbnails); $all_images_tmp = count($all_images); for($i = 0; $i < $all_images_tmp; $i++){ $o0 .= ((substr($all_images[$i],0,7) == "http://" || substr($all_images[$i],0,8) == "https://")?$all_images[$i]:$yangfamily_site."/img/life/".rawurlencode($all_images[$i]))."|"; } $img_all = ""; // Get IP Address if (!empty($_SERVER['HTTP_CLIENT_IP'])){ $ip=$_SERVER['HTTP_CLIENT_IP']; }else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; }else{ $ip=$_SERVER['REMOTE_ADDR']; } include "../../array-lang_full_name.php"; /*$str = "select count(*) from yangfamily_click where pattern='click'"; $list = $link->query($str); list($c) = $list->fetch_row(); $c++;*/ $ip_to_long = ip2long($ip); $str = "select country from ip_to_country2 where start<='$ip_to_long' and end>='$ip_to_long'"; $list = $link->query($str); list($country) = $list->fetch_row(); $list->close(); if(empty($country)) $country = "Unknown"; if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) $lang = strtolower(strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',')); else $lang = "Unknown"; if(isset($lang_full_name[$lang])) $lang_name = $lang_full_name[$lang]; else $lang_name = "Unknown"; if(isset($_SERVER['HTTP_USER_AGENT'])) $browser = $_SERVER['HTTP_USER_AGENT']; else $browser = "Unknown"; $time = time(); //$str = "insert into yangfamily_click (id,to_time,category,time,title,pattern,ip,country,browser,pc_language,author) values ('$c','$id','life','$time','','click','$ip','$country','$browser','$lang_name','111')"; $ip = $link->real_escape_string($ip); $country = $link->real_escape_string($country); $browser = $link->real_escape_string($browser); $lang_name = $link->real_escape_string($lang_name); $str = "insert into yangfamily_click (to_time,category,time,title,pattern,ip,country,browser,pc_language,author) values ('$id','life','$time','','click','$ip','$country','$browser','$lang_name','111')"; $link->query($str); $str = "update yangfamily_count set count=count+1 where to_time='$id' and category='life'"; $link->query($str); $str = "insert into yangfamily_count (to_time,category,count) select '$id','life','1' where not exists (select * from yangfamily_count where to_time='$id' and category='life')"; $link->query($str); $str = "select count from yangfamily_count where to_time='$id' and category='life'"; $list = $link->query($str); list($count) = $list->fetch_row(); $list->close(); $str = "select count(*) from yangfamily_like where to_time='".$id."' and hidden='F' and category='life'"; $list = $link->query($str); list($like_count) = $list->fetch_row(); $list->close(); $str = "select title from yangfamily_yang where pattern='grayscale'"; $list = $link->query($str); list($grayscale) = $list->fetch_row(); $list->close(); $str = "select count(*) from yangfamily_comments where title='$id' and location='0'"; $list = $link->query($str); list($comments_count) = $list->fetch_row(); $list->close(); $has_clicked_like = 0; if(isset($_SESSION['LoginID']) && isset($_SESSION['LoginN'])){ $str = "select count(*) from yangfamily_like where to_time='".$id."' and hidden='F' and category='life' and content='".$_SESSION['LoginID']."' and location='".$_SESSION['LoginN']."'"; $list = $link->query($str); list($has_clicked_like) = $list->fetch_row(); $list->close(); } $link->close(); $header_bg_css = "life"; $chat_getIn = 0; $nav_show = ""; $js_page = 601; $js_page_data = $page_data; $session_id = ""; $tmp_noti_dont_show = (isset($_GET['do']))?"1":"0"; $left = $chatroom_msg_left_right_reverse?'left':'right'; $right = $chatroom_msg_left_right_reverse?'right':'left'; function aes_encrypt($plaintext, $key) { // 必須是 16/24/32 bytes,決定是 AES-128/192/256 $key = hash('sha256', $key, true); // 產生 32 bytes,用於 AES-256 $iv = openssl_random_pseudo_bytes(16); // CBC 模式固定為 16 bytes $ciphertext = openssl_encrypt( $plaintext, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv ); // 通常會把 IV + cipher 合併後再 base64 傳輸 return base64_encode($iv . $ciphertext); } function randStr(){ $result = ""; for($i = 0; $i < 16; $i++){ $result .= chr(rand(33,126)); } return $result; } $randString = randStr(); ?> echo $img_all; ?>
載入中 |